<template>
	<view class="detail">
		<scroll-view scroll-y="true" class="main">
			<view class="swiperBox">
				<u-swiper :list="info.images" height="550rpx"></u-swiper>
			</view>
			<view class="title">{{info.name}}</view>
			<view class="numBox">
				<view class="num"><text class="icon">¥</text>{{info.price}}/{{info.unit_price}}</view>
			</view>
			<view class="descT">技能介绍</view>
			<view class="desc">
				{{info.content}}
			</view>
			<view class="descT">案例</view>
			<view class="caseBox">
				<image v-for="(item,index) in info.demoimages" :src="item" class="case" mode="widthFix"></image>
			</view>
		</scroll-view>
		<view class="btn" @click="down">下单</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: true,
				list: [
					'https://cdn.uviewui.com/uview/swiper/swiper1.png',
					'https://cdn.uviewui.com/uview/swiper/swiper2.png',
					'https://cdn.uviewui.com/uview/swiper/swiper3.png',
				],
				info: ''
			};
		},
		onLoad(options) {
			this.getDetail(options.id)
		},
		methods:{
			down() {
				uni.$u.route({
					url: 'pages/common/pay',
					params: {
						id: this.info.id,
						money: this.info.price
					}
				})
			},
			getDetail(id) {
				uni.$u.http.post('/skilldetail', {
					id: id
				}).then(res => {
					if (res.code == 1) {
						if(res.data.demoimages) {
							res.data.demoimages = res.data.demoimages.map((value) => {
								return this.oss(value)
							})
						} else {
							res.data.demoimages = []
						}
						if(res.data.images) {
							res.data.images = res.data.images.map((value) => {
								return this.oss(value)
							})
						} else {
							res.data.images = []
						}
						this.info = res.data
					}
				}).catch((res) => {
				
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	// page {
	// 	height: 100%;
	// }

	.detail {
		height: 100vh;
		position: relative;
		.record{
			position: absolute;
			right: 30rpx;
			bottom: 200rpx;
			width: 112rpx;
			height: 112rpx;
			background: linear-gradient(to bottom, #95C0FF, #428DFC);
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			border-radius: 50%;
			z-index: 1000;
			.icon{
				width: 36rpx;
				height: 40rpx;
			}
			.word{
				color: #FFFFFF;
				font-size: 24rpx;
			}
		}
		.main {
			position: absolute;
			left: 0;
			top: 0;
			width: 100%;
			bottom: 120rpx;
		}

		.btn {
			background: linear-gradient(to right, #FFDF41, #FFC141);
			height: 88rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 32rpx;
			color: #191615;
			border-radius: 44rpx;
			width: 590rpx;
			position: absolute;
			left: 80rpx;
			bottom: 20rpx;
			flex-shrink: 0;
		}
		.user{
			width: 520rpx;
			height: 540rpx;
			border-radius: 30rpx;
			background-color: #FFFFFF;
			display: flex;
			flex-direction: column;
			align-items: center;
			padding: 0 50rpx;
			box-sizing: border-box;
			.avatar{
				width: 170rpx;
				height: 170rpx;
				border-radius: 50%;
				border-radius: 50%;
				margin-top: -80rpx;
				margin-bottom: 20rpx;
			}
			.name{
				color: #191615;
				font-size: 36rpx;
				margin-bottom: 20rpx;
			}
			.tel{
				color: #191615;
				font-size: 30rpx;
				margin-bottom: 20rpx;
			}
			.info{
				background-color: #FFFAE5;
				border: 10rpx;
				padding: 20rpx;
				color: #FF8007;
				font-size: 22rpx;
				margin-bottom: 40rpx;
			}
			.btns{
				background: linear-gradient(to right, #FFDF41, #FFC141);
				display: flex;
				align-items: center;
				justify-content: center;
				width: 400rpx;
				height: 72rpx;
				color: #191615;
				font-size: 30rpx;
				border-radius: 36rpx;
			}
		}

		.title {
			padding: 40rpx 40rpx 10rpx;
			border-radius: 40rpx 40rpx 0 0;
			margin-top: -40rpx;
			z-index: 10000;
			position: relative;
			background-color: #fff;
			color: #191615;
			font-size: 40rpx;
			font-weight: bold;
		}
		.caseBox{
			padding: 20rpx 40rpx;
			.case{
				width: 100%;
			}
		}
		.numBox {
			display: flex;
			align-items: center;
			padding: 0 40rpx;
			color: #999999;
			font-size: 24rpx;

			.num {
				color: #FF5B1A;
				font-size: 44rpx;
				margin-right: 10rpx;

				.num {
					font-size: 30rpx;
				}
			}
		}

		.line {
			display: flex;
			align-items: center;
			padding: 10rpx 40rpx;

			.icon {
				width: 9rpx;
				height: 35rpx;
				background: linear-gradient(to right, #FFC141, #FFDF41);
				border-radius: 0 9rpx 9rpx 0;
			}

			.l {
				color: #999999;
				font-size: 28rpx;
				margin: 0 0 0 20rpx;
			}

			.r {
				color: #575859;
				font-size: 28rpx;
			}
		}

		.address {
			display: flex;
			padding: 0 40rpx;
			align-items: flex-start;

			.icon {
				width: 20rpx;
				height: 27rpx;
				margin-top: 10rpx;
				margin-right: 10rpx;
			}

			.l {
				color: #575859;
				font-size: 28rpx;
				flex-shrink: 0;
			}

			.r {
				color: #575859;
				font-size: 28rpx;
			}
		}

		.descT {
			color: #191615;
			font-size: 34rpx;
			padding: 20rpx 40rpx 0;
		}

		.desc {
			color: #575859;
			font-size: 24rpx;
			line-height: 40rpx;
			padding: 0 40rpx;
		}

		.notice {
			width: 600rpx;
			margin: 20rpx 40rpx;
			position: relative;

			.bg {
				position: absolute;
				left: 0;
				top: 0;
				width: 100%;
				height: 100%;
				z-index: 10;
			}

			.con {
				position: relative;
				z-index: 1000;
				display: flex;
				align-items: flex-start;
				width: 100%;
				padding: 20rpx;
				box-sizing: border-box;

				.l {
					flex-shrink: 0;
					font-size: 26rpx;
					color: #FF8007;
					margin-right: 10rpx;
				}

				.r {
					color: #FF8007;
					font-size: 26rpx;
				}

			}
		}
		
	}
</style>
